home *** CD-ROM | disk | FTP | other *** search
/ IRIX 6.4 Applications 1997 August / SGI IRIX 6.4 Applications 1997 August.iso / dist / mmailp.idb / usr / lib / Zmail / samples / zscript / readrcpt.zsc.z / readrcpt.zsc
Encoding:
Text File  |  1997-01-22  |  1.2 KB  |  40 lines

  1. # Sample Z-Script  function: confirm_read
  2. #                    header: X-Acknowledge
  3.  
  4. # Check for an X-Acknowledge header on any message that is
  5. # displayed and ask the user to confirm reading the message.
  6.  
  7. function confirm_read() {
  8.     #
  9.     # Get the value of the X-Acknowledge header
  10.     set acks = "$[%?X-Acknowledge?]"
  11.     # Check whether it includes "read", using lower case
  12.     # The X makes sure "if" never receives an empty arg
  13.     if "X$acks:l" =~ *read*
  14.     # Check to see if message has already been read
  15.     # by checking the content of the Status: header, which
  16.     # will contain an 'R' if so.
  17.     set stat = "$[%?Status?]"
  18.     if "X$stat" =~ *R*
  19.         # Uncomment the following line if you're testing
  20.         # the implementation of read receipt and want to
  21.         # verify you get here
  22.         #echo -d "Already read!"
  23.         return -1
  24.     endif
  25.     # Ask whether to acknowledge, not to, or cancel
  26.     ask "Acknowledge that you've read this message?"
  27.     if $status == 0
  28.         # If acknowledged, send the reply
  29.         reply -send -file $home/.acknowledged
  30.     else
  31.         if $status < 0
  32.         # If canceled, don't continue display
  33.         thwart
  34.         endif
  35.     endif
  36.     endif
  37. }
  38. interpose -operation display confirm_read
  39. my_hdr X-Acknowledge: "[read|no]"
  40.